package de.breitbeil.jbooking.ui.dataview.columns;

import java.util.Comparator;

import javax.swing.table.TableCellRenderer;

import de.breitbeil.jbooking.ui.dataview.DataView;

/**
 * A DataViewColumn describes the structure of a column 
 * in a {@link DataView}.
 * <p>
 * You can define a {@link TableCellRenderer}, a {@link Comparator} which 
 * is used to sort the column and specify the name of the header.
 * 
 * @author Dominik Breitbeil
 *
 */
public interface DataViewColumn {

    /**
     * The column name as i8n code.
     * @return the column name as i8n code.
     */
    public String getColumnName();
    
    /**
     * The {@link TableCellRenderer} which is used to render the cells of this column.
     * @return {@link TableCellRenderer} which is used to render the cells of this column.
     */
    public TableCellRenderer getCellRenderer();
    
    /**
     * Defines if the {@link TableCellRenderer} does need the complete row object or just
     * one property of it. If this returns <code>true</code>, the {@link TableCellRenderer}
     * will get the row object. Otherwise it will get the property defined by the name of
     * this column.
     * 
     * @return <code>true</code> if the {@link TableCellRenderer} does need the complete
     * row object to render this column.
     */
    public boolean isObjectCellRenderer();
    
    /**
     * Returns the preffered width of this columns.
     * @return the preffered width of this column.
     */
    public int getPreferredWidth();
    
    /**
     * Returns the {@link Comparator} to sort this column, or <code>null</code> if this
     * column is not sortable.
     * @return the {@link Comparator} for this column, or <code>null</code> if this column
     * is not sortable.
     */
    public Comparator<?> getComparator();
    
    /**
     * Returns an array of properties of the row objects, which are added to the text filter
     * of the {@link DataView}.
     * The user can filter the table content across these properties. 
     * @return
     */
    public String[] getFilterProperties();
    
}
